From: Owen W. Taylor Date: Thu, 6 Aug 2009 21:59:20 +0000 (-0400) Subject: Check the result of fgets() to deal with warn_unused_result X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~11145 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=59532ab0c738f28e74df1f0f885faf05a1bd187d;p=gnome-shell.git Check the result of fgets() to deal with warn_unused_result Some C library versions have __attribute__((warn_unused_result)) on fgets(). We really don't care since we are just throwing the data away, but check the result anyways. --- diff --git a/src/shell-recorder.c b/src/shell-recorder.c index 2ff7d5a84..70f833eb2 100644 --- a/src/shell-recorder.c +++ b/src/shell-recorder.c @@ -221,7 +221,8 @@ get_memory_target (void) return mem_total / 2; } /* Skip to the next line and discard what we read */ - fgets(line_buffer, sizeof(line_buffer), f); + if (fgets(line_buffer, sizeof(line_buffer), f) == NULL) + break; } fclose(f);